package myredis

import (
	"dy/internal/configs/config"
	"github.com/go-redis/redis"
	_ "github.com/go-sql-driver/mysql"
)

func GetRedisFactory() (*redis.Client, error) {
	var rdb *redis.Client

	rdb = redis.NewClient(&redis.Options{
		Addr:     config.Conf.Redis.Addr,
		Password: config.Conf.Redis.PassWord,
		DB:       config.Conf.Redis.Db,
	})
	_, err := rdb.Ping().Result()
	if err != nil {
		return nil, err
	}

	return rdb, nil
}
